home *** CD-ROM | disk | FTP | other *** search
/ Aminet 20 / Aminet 20 (1997)(GTI - Schatztruhe)[!][Aug 1997].iso / Aminet / dev / src / DICE_SharedLib.lha / Misc.c < prev    next >
C/C++ Source or Header  |  1997-06-23  |  3KB  |  107 lines

  1. //
  2. //        Example Shared Library Code
  3. //        Compiles with DICE
  4. //        
  5. //        By Wez Furlong <wez@twinklestar.demon.co.uk>
  6. //
  7. //        Based on code by Geert Uytterhoeven and Matt Dillon
  8. //
  9. //        This source was produced:    Monday 23-Jun-1997 
  10. //
  11. //        DISCLAIMER
  12. //
  13. //        Please read the code FULLY before use... I could have put ANYTHING in
  14. //        here; I may have the code format your bootdrive for example.
  15. //
  16. //        NEVER trust example code without fully understanding what it does.
  17. //
  18. //        This code comes with no warranty; I am NOT responsible for any damage
  19. //        that may ensue from its use, be it physical, mental or otherwise.
  20. //
  21. //        This code may be modified, so long as the names of myself, Geert and
  22. //        Matt are mentioned within any release or distribution produced using it,
  23. //        and a copy sent to myself.
  24. //
  25. //        This code may be redistributed freely; no profit is allowed to be made
  26. //        from its distribution.
  27. //
  28. //        This code may be included on an Aminet or Fred Fish CD.
  29. //
  30.  
  31. /*--- Includes ------------------*/
  32.  
  33. #include "example.h"
  34.  
  35. /*--- Prototypes ----------------*/
  36.  
  37. Prototype BOOL Init(void);
  38. Prototype BOOL CleanUp(void);
  39. Prototype LibCall ULONG LibOBSOLETE(void);
  40.  
  41. /*--- #defines ------------------*/
  42.  
  43. /*--- Globals -------------------*/
  44.  
  45. struct ExecBase *SysBase;
  46. struct LibraryBase *LibraryBase;
  47. struct DosLibrary *DOSBase = NULL;
  48. struct IntuitionBase *IntuitionBase = NULL;
  49. struct Library *UtilityBase = NULL;
  50.  
  51. /*--- Functions -----------------*/
  52.  
  53. /*---------------------------------------------------Initialisation--------
  54. -------------------------------------------------------------------------*/
  55.  
  56.  
  57. BOOL Init(void)
  58. {
  59.  
  60.     if (!InitMemory())
  61.         return(FALSE);
  62.  
  63.  
  64.     if (!(DOSBase = (struct DosLibrary *)OpenLibrary("dos.library", 37)) ||
  65.          !(IntuitionBase = (struct IntuitionBase *)OpenLibrary("intuition.library", 37)) ||
  66.          !(UtilityBase = OpenLibrary("utility.library", 37)) 
  67.         )
  68.  
  69.         return(FALSE);
  70.  
  71.     initstuff();
  72.     
  73.     return(TRUE);
  74. }
  75.  
  76.  
  77. /*---------------------------------------------------------Clean Up--------
  78. -------------------------------------------------------------------------*/
  79.  
  80.  
  81. BOOL CleanUp(void)
  82. {
  83.  
  84.     CleanUpMemory();
  85.  
  86.     if (UtilityBase)
  87.         CloseLibrary(UtilityBase);
  88.     if (IntuitionBase)
  89.         CloseLibrary((struct Library *)IntuitionBase);
  90.     if (DOSBase)
  91.         CloseLibrary((struct Library *)DOSBase);
  92.  
  93.     return(TRUE);
  94. }
  95.  
  96.  
  97. /*-----------------------------Entry for Obsolete Library Functions--------
  98. -------------------------------------------------------------------------*/
  99.  
  100.  
  101. LibCall ULONG LibOBSOLETE(void)
  102. {
  103.     return(NULL);
  104. }
  105.  
  106.  
  107.